// foreach + 立即执行
function makeClosures(arr, fn) {
    let result = [];
    arr.forEach(function (e) {
        result.push(function (num) {
            return function () {
                return fn(num);
            };
        }(e));
    });
    return result;
}

// foreach + bind
function makeClosures(arr, fn) {
    var result = [];
    arr.forEach(function (v) {
        result.push(fn.bind(this, v));
    })
    return result;
}

// for+立即执行
function makeClosures(arr, fn) {
    var result = [];
    for (var i = 0; i < arr.length; i++) {
        result.push((function (num) {
            return function () {
                return fn(arr[num])
            };
        })(i));
    }
    return result;
}

